package net.kazed.nextaction.timer;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * Processes timer notification.
 * @author Koert Zeilstra
 */
public class TimerProcessor extends BroadcastReceiver {

    /**
     * Constructor.
     */
    public TimerProcessor() {
      super();
   }

   @Override
    public void onReceive(Context context, Intent intent) {
      Notifier notifier = new Notifier(context);
      notifier.onReceive(intent);
      
//      Bundle bundle = intent.getExtras();
//      Uri notificationUri = intent.getData();
//      if (Notifier.TOPLEVEL_CONTENT_TIMER_URI.equals(notificationUri)) {
//         long startTime = bundle.getLong("startTime");
//         int durationMinutes = bundle.getInt("durationMinutes");
//         long finishTime = startTime + durationMinutes * 60000;
//         if (System.currentTimeMillis() > finishTime) {
//            notifier.timerStop(intent);
//         } else {
//            notifier.timerUpdate(intent);
//         }
//      } else {
//         int taskId = bundle.getInt("taskId");
//         long startTime = bundle.getLong("startTime");
//         int durationMinutes = bundle.getInt("durationMinutes");
//         String taskDescription = bundle.getString("text");
//         long finishTime = startTime + durationMinutes * 60000;
//         if (System.currentTimeMillis() > finishTime) {
//            notifier.timerStop(taskId, taskDescription);
//         } else {
//            notifier.timerUpdate(taskId, startTime, durationMinutes, taskDescription);
//         }
//      }
   }

}
